﻿<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
    <title></title>
    <script type="text/javascript">
        var i = 1;
        var b = true;
        window.onload=function (){
       var InterValId=  setInterval(function() { document.getElementById('txt').value = i;
            if (i>50) {
                b = !b;
            }
            if (i<0) {
                b = !b;
            }
            if (b) {
                i++;
            } else {
                i--;
            }
            document.getElementById('txt').width = 10000;
        }, 1000);
        document.getElementById('btn').onclick= function() {
            clearInterval(InterValId);
        }
        }
    </script>
</head>
<body>
    <input type="text" id="txt"/>
    <input type="button" id ="btn" value="stop"/>
</body>
</html>
